/*
   Copyright (c) 2007-10, iUI Project Members
   See LICENSE.txt for licensing terms
 */

//
// iui-unloader.js
//
// An iUI extension that will remove any iUI fragment or view (aka "page") when it receives
// an 'unload' event from iUI core.
//
// This will prevent your DOM from getting overloaded.  It can also be used as a template
// for a more advanced unloading scheme.
//
// requires querySelectorAll, therefore iPhone OS 2.x or later
// or Safari 3.x or later
//
//
iui.Extension('unloader', {
  afterinsert: function() { 
    this.unloadable = true; 
  },
  unload: function() {
    if(this.unloadable) this.parentNode.removeChild(this);
  }
});
